<?

if ($c = stack('name')) {

	$_id_component	= $DATA['components'][$c]['id'];			//	list id value
	$_id_data		= D_MB_DATA;			//	meta id value
	$_id_meta		= D_MB_META;			//	meta id value
	
	$_crit = "id_data=$_id_data AND id_parent=$_id_component AND attr & ".AA_VISIBLE;


	$s = array_extend( array('w' => 800, 'h' => 600, 'param' => 'id',
			'template' => '<iframe width="{w}" height="{h}" src="http://www.youtube.com/embed/{id}?rel=0" frameborder="0" allowfullscreen></iframe>', 
			'nav' => 0, 'navigator' => 1, 'circular' => 0, 'autoscroll' => 0, 'show_title' => 0, 'show_descr' => 0, 'caption' => ''), $DATA['components'][$c]['settings']);
			
	$tpl_tags = array(
		'id' => '',
		'w'  => $s['w'],
		'h'  => $s['h'],
	);

	$se = array(); $re = array();	foreach($tpl_tags as $k => $v) { $se[] = '{'.$k.'}'; $re[] = $v; }
			
	$temp = array_mark_bounds( datafetch_array('db_list', array('table' => tb('data'), 'where' => "$_crit",	'order' => 'id_index', 'index' => 'id' )));

	foreach($temp as $k => $v) {
		$temp[$k] = array_merge($v, datafetch_array('loadmeta', $_id_meta, array('parent' => $k, 'assoc' => context('lang'), 'getclob' => true)));
		$re[0] = $temp[$k]['article'];
		$temp[$k]['template'] = str_replace($se, $re, $s['template']);
	}

	$DATA['components'][$c]['data'] = $temp;
	
	unstack();
}